<?php


namespace app\service;

use app\model\ModelAppLoginLog;

/**
 * Class TokenService
 * @package app\service
 */
class TokenService extends BaseService
{
    /**
     * @param array $data
     * @return bool
     */
    public function insertToken(array $data) : array
    {
        $modelAppLoginLog = new ModelAppLoginLog();
        $result = $modelAppLoginLog->insert($data);
        return $this->success('成功', $result);
    }

    /**
     * @param array $where 更新条件
     * @param array $data 更新的数据
     * @return bool
     */
    public function updateToken(array $where,array $data) : array {
        $modelAppLoginLog = new ModelAppLoginLog();
        $result = $modelAppLoginLog -> where($where) -> save($data);;
        return $this->success('成功', $result);
    }

    /**
     * @param array $where 更新条件
     * @return bool
     */
    public function checkToken(array $where) : array {
        $modelAppLoginLog = new ModelAppLoginLog();
        $result = $modelAppLoginLog -> where($where) -> findOrEmpty() -> toArray();
        //echo ($modelAppLoginLog->getLastSql());die();
        return $this->success('成功', $result);
    }

}